package com.ymm.spark.dao.impl;

import com.ymm.spark.config.JdbcHelper;
import com.ymm.spark.dao.ISessionAggrStatDAO;
import com.ymm.spark.domain.SessionAggrStat;

/**
 * @author zhangj
 * @date 2019/11/1
 * session聚合统计访问DAO实现类
 */
public class ISessionAggrStatDAOImpl implements ISessionAggrStatDAO {
	/**
	 * 插入session访问统计结果
	 *
	 * @param sessionAggrStat
	 */
	@Override
	public void insert(SessionAggrStat sessionAggrStat) {
		String sql = "insert into session_aggr_stat values(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)";

		Object[] param = new Object[]{sessionAggrStat.getTaskid(),
				sessionAggrStat.getSession_count(),
				sessionAggrStat.getVisit_length_1s_3s_ratio(),
				sessionAggrStat.getVisit_length_4s_6s_ratio(),
				sessionAggrStat.getVisit_length_7s_9s_ratio(),
				sessionAggrStat.getVisit_length_10s_30s_ratio(),
				sessionAggrStat.getVisit_length_30s_60s_ratio(),
				sessionAggrStat.getVisit_length_1m_3m_ratio(),
				sessionAggrStat.getVisit_length_3m_10m_ratio(),
				sessionAggrStat.getVisit_length_10m_30m_ratio(),
				sessionAggrStat.getVisit_length_30m_ratio(),
				sessionAggrStat.getStep_length_1_3_ratio(),
				sessionAggrStat.getStep_length_4_6_ratio(),
				sessionAggrStat.getStep_length_7_9_ratio(),
				sessionAggrStat.getStep_length_10_30_ratio(),
				sessionAggrStat.getStep_length_30_60_ratio(),
				sessionAggrStat.getStep_length_60_ratio()};
		//执行SQL语句
		JdbcHelper.getInstance().executeUpdate(sql, param);
	}
}
